Optimal. Leaf size=80 \[ -\frac {(b B-a C) x}{a^2+b^2}+\frac {B \log (\sin (c+d x))}{a d}-\frac {b (b B-a C) \log (a \cos (c+d x)+b \sin (c+d x))}{a \left (a^2+b^2\right ) d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.14, antiderivative size = 80, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 40, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.100, Rules used = {3713, 3692,
3611, 3556} \begin {gather*} -\frac {b (b B-a C) \log (a \cos (c+d x)+b \sin (c+d x))}{a d \left (a^2+b^2\right )}-\frac {x (b B-a C)}{a^2+b^2}+\frac {B \log (\sin (c+d x))}{a d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3611
Rule 3692
Rule 3713
Rubi steps
\begin {align*} \int \frac {\cot ^2(c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{a+b \tan (c+d x)} \, dx &=\int \frac {\cot (c+d x) (B+C \tan (c+d x))}{a+b \tan (c+d x)} \, dx\\ &=-\frac {(b B-a C) x}{a^2+b^2}+\frac {B \int \cot (c+d x) \, dx}{a}-\frac {(b (b B-a C)) \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)} \, dx}{a \left (a^2+b^2\right )}\\ &=-\frac {(b B-a C) x}{a^2+b^2}+\frac {B \log (\sin (c+d x))}{a d}-\frac {b (b B-a C) \log (a \cos (c+d x)+b \sin (c+d x))}{a \left (a^2+b^2\right ) d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.25, size = 113, normalized size = 1.41 \begin {gather*} -\frac {\frac {(B+i C) \log (i-\tan (c+d x))}{a+i b}-\frac {2 B \log (\tan (c+d x))}{a}+\frac {(B-i C) \log (i+\tan (c+d x))}{a-i b}+\frac {2 b (b B-a C) \log (a+b \tan (c+d x))}{a \left (a^2+b^2\right )}}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.49, size = 101, normalized size = 1.26
method | result | size |
derivativedivides | \(\frac {\frac {\frac {\left (-a B -C b \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-B b +C a \right ) \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}-\frac {\left (B b -C a \right ) b \ln \left (a +b \tan \left (d x +c \right )\right )}{a \left (a^{2}+b^{2}\right )}+\frac {B \ln \left (\tan \left (d x +c \right )\right )}{a}}{d}\) | \(101\) |
default | \(\frac {\frac {\frac {\left (-a B -C b \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-B b +C a \right ) \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}-\frac {\left (B b -C a \right ) b \ln \left (a +b \tan \left (d x +c \right )\right )}{a \left (a^{2}+b^{2}\right )}+\frac {B \ln \left (\tan \left (d x +c \right )\right )}{a}}{d}\) | \(101\) |
norman | \(-\frac {\left (B b -C a \right ) x}{a^{2}+b^{2}}+\frac {B \ln \left (\tan \left (d x +c \right )\right )}{a d}-\frac {\left (a B +C b \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d \left (a^{2}+b^{2}\right )}-\frac {\left (B b -C a \right ) b \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right ) a d}\) | \(106\) |
risch | \(-\frac {i x B}{i b -a}-\frac {x C}{i b -a}+\frac {2 i b^{2} B x}{a \left (a^{2}+b^{2}\right )}+\frac {2 i b^{2} B c}{a d \left (a^{2}+b^{2}\right )}-\frac {2 i b C x}{a^{2}+b^{2}}-\frac {2 i b C c}{\left (a^{2}+b^{2}\right ) d}-\frac {2 i x B}{a}-\frac {2 i B c}{a d}-\frac {b^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) B}{a d \left (a^{2}+b^{2}\right )}+\frac {b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) C}{\left (a^{2}+b^{2}\right ) d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) B}{a d}\) | \(240\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.52, size = 107, normalized size = 1.34 \begin {gather*} \frac {\frac {2 \, {\left (C a - B b\right )} {\left (d x + c\right )}}{a^{2} + b^{2}} + \frac {2 \, {\left (C a b - B b^{2}\right )} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{3} + a b^{2}} - \frac {{\left (B a + C b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} + \frac {2 \, B \log \left (\tan \left (d x + c\right )\right )}{a}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.14, size = 118, normalized size = 1.48 \begin {gather*} \frac {2 \, {\left (C a^{2} - B a b\right )} d x + {\left (B a^{2} + B b^{2}\right )} \log \left (\frac {\tan \left (d x + c\right )^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) + {\left (C a b - B b^{2}\right )} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right )}{2 \, {\left (a^{3} + a b^{2}\right )} d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [C] Result contains complex when optimal does not.
time = 2.50, size = 966, normalized size = 12.08 \begin {gather*} \begin {cases} \frac {\tilde {\infty } x \left (B \tan {\left (c \right )} + C \tan ^{2}{\left (c \right )}\right ) \cot ^{2}{\left (c \right )}}{\tan {\left (c \right )}} & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {- \frac {B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {B \log {\left (\tan {\left (c + d x \right )} \right )}}{d} + C x}{a} & \text {for}\: b = 0 \\\frac {- B x - \frac {B}{d \tan {\left (c + d x \right )}} - \frac {C \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {C \log {\left (\tan {\left (c + d x \right )} \right )}}{d}}{b} & \text {for}\: a = 0 \\\frac {B d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {i B d x}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {i B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {2 i B \log {\left (\tan {\left (c + d x \right )} \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {2 B \log {\left (\tan {\left (c + d x \right )} \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {B}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {i C d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {C d x}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {i C}{2 b d \tan {\left (c + d x \right )} - 2 i b d} & \text {for}\: a = - i b \\\frac {B d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {i B d x}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {i B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {2 i B \log {\left (\tan {\left (c + d x \right )} \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {2 B \log {\left (\tan {\left (c + d x \right )} \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {B}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {i C d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {C d x}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {i C}{2 b d \tan {\left (c + d x \right )} + 2 i b d} & \text {for}\: a = i b \\\frac {x \left (B \tan {\left (c \right )} + C \tan ^{2}{\left (c \right )}\right ) \cot ^{2}{\left (c \right )}}{a + b \tan {\left (c \right )}} & \text {for}\: d = 0 \\- \frac {B a^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{3} d + 2 a b^{2} d} + \frac {2 B a^{2} \log {\left (\tan {\left (c + d x \right )} \right )}}{2 a^{3} d + 2 a b^{2} d} - \frac {2 B a b d x}{2 a^{3} d + 2 a b^{2} d} - \frac {2 B b^{2} \log {\left (\frac {a}{b} + \tan {\left (c + d x \right )} \right )}}{2 a^{3} d + 2 a b^{2} d} + \frac {2 B b^{2} \log {\left (\tan {\left (c + d x \right )} \right )}}{2 a^{3} d + 2 a b^{2} d} + \frac {2 C a^{2} d x}{2 a^{3} d + 2 a b^{2} d} + \frac {2 C a b \log {\left (\frac {a}{b} + \tan {\left (c + d x \right )} \right )}}{2 a^{3} d + 2 a b^{2} d} - \frac {C a b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{3} d + 2 a b^{2} d} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.93, size = 113, normalized size = 1.41 \begin {gather*} \frac {\frac {2 \, {\left (C a - B b\right )} {\left (d x + c\right )}}{a^{2} + b^{2}} - \frac {{\left (B a + C b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} + \frac {2 \, {\left (C a b^{2} - B b^{3}\right )} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{3} b + a b^{3}} + \frac {2 \, B \log \left ({\left | \tan \left (d x + c\right ) \right |}\right )}{a}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 9.46, size = 115, normalized size = 1.44 \begin {gather*} \frac {B\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )}{a\,d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (-C+B\,1{}\mathrm {i}\right )}{2\,d\,\left (-b+a\,1{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B-C\,1{}\mathrm {i}\right )}{2\,d\,\left (a-b\,1{}\mathrm {i}\right )}-\frac {b\,\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )\,\left (B\,b-C\,a\right )}{a\,d\,\left (a^2+b^2\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________